Add CompletionRequest.StreamOptions#959
Merged
sashabaranov merged 1 commit intosashabaranov:masterfrom Apr 29, 2025
Merged
Conversation
The legacy completion API supports a `stream_options` object when `stream` is set to true [0]. This adds a StreamOptions property to the CompletionRequest struct to support this setting. [0] https://platform.openai.com/docs/api-reference/completions/create#completions-create-stream_options Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #959 +/- ##
==========================================
+ Coverage 98.46% 98.88% +0.41%
==========================================
Files 24 27 +3
Lines 1364 1786 +422
==========================================
+ Hits 1343 1766 +423
+ Misses 15 14 -1
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the change
The legacy completion API supports a
stream_optionsobject whenstreamis set to true. This adds a StreamOptions property to the CompletionRequest struct to support this setting.Provide OpenAI documentation link
https://platform.openai.com/docs/api-reference/completions/create#completions-create-stream_options
Describe your solution
This adds a
StreamOptionsproperty (marshaled asstream_options) to theCompletionRequeststruct to expose the setting. This matches theChatCompletionRequestproperty.